package hdf5.gui.listeners;

import hdf5.gui.Player;

import javax.imageio.ImageIO;
import java.awt.*;
import java.io.File;
import java.io.IOException;


public class SaveAsImageListener extends SaveAsListener{

    public SaveAsImageListener(Component component) {
        setFileChooserProperty();
        this.component = component;
    }

    @Override
    protected String getExtension() {
        return "png";
    }

    @Override
    protected void saveAs(File file) throws IOException {
        ImageIO.write(Player.getInstance().getImage(), getExtension(), file);
    }
}
